package org.xjtu.weteam.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;
import org.xjtu.weteam.model.domain.File;
import org.xjtu.weteam.model.dto.FileDTO;

import java.util.List;

/**
 * @author Kevin
 */

@Mapper
public interface FileMapper extends BaseMapper<File> {

    List<FileDTO> listFiles(@Param("projectId")Integer projectId, @Param("userId") Integer userId);

    int updateFiles(File file);

    int deleteFile(@Param("fileId")Integer fileID);

    File getFileById(@Param("fileId")Integer fileID);

    String getFilePath(@Param("fileId")Integer fileID);

    void updateFileName(@Param("fileName") String newFileName, @Param("fileId") Integer fileId);
    @Update("update file set project_id = #{projectId} where file_id = #{fileId}")
    void updateProjectId(@Param("fileId") Integer fileId, @Param("projectId") Integer projectId);
}
